package com.example.newland.myapplication3;

import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        h.postDelayed(r,1000);


    }
    private Handler h = new Handler();
    private Runnable r= new Runnable() {
        int aa,bb,cc;
        @Override
        public void run() {

            Intent intent = new Intent("broadsend.action");
            aa+=1;
            bb+=2;
            cc+=3;

            intent.putExtra("aa",aa);
            intent.putExtra("bb",bb);
            intent.putExtra("cc",cc);

            sendBroadcast(intent);

            h.postDelayed(r,1000);
        }
    };

    public void onClick(View view) {
        startActivity(new Intent(this,Main2Activity.class));
    }
}
